this.getIt = (function () {

	function getDefaultExportFromCjs (x) {
		return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
	}

	var logUtils$4 = {
	  showing: false,
	  show () {
	    console.show ();
	    this.showing = true;
	  },
	  hide () {
	    console.hide ();
	    this.showing = false;
	  },
	  log () {
	    console.log.apply (console, arguments);
	  },
	};

	var clickUtils$3 = {
	  getRateX(x, w) {
	    return parseInt(x * (device.width / (w || device.width)));
	  },
	  getRateY(y, h) {
	    return parseInt(y * (device.height / (h || device.height)));
	  },
	  clickXY(x, y) {
	    click(x, y);
	  },
	  clickXYZW(x, y, z, w, deltaX, deltaY) {
	    var maxDeltaX = Math.abs(z - x) / 2;
	    var maxDeltaY = Math.abs(w - y) / 2;
	    deltaX = deltaX || 1;
	    deltaY = deltaY || 1;
	    deltaX = deltaX > maxDeltaX ? maxDeltaX - 2 : deltaX;
	    deltaY = deltaY > maxDeltaY ? maxDeltaY - 2 : deltaY;
	    this.clickXY(
	      random(x + deltaX, z - deltaX),
	      random(y + deltaY, w - deltaY)
	    );
	  },
	  clickBounds(bounds, deltaX, deltaY) {
	    var left = bounds.left;
	    var right = bounds.right;
	    var top = bounds.top;
	    var bottom = bounds.bottom;
	    this.clickXYZW(left, top, right, bottom, deltaX, deltaY);
	  },
	  clickPointMap(pointMap, deltaX, deltaY) {
	    var point = pointMap[0];
	    var width = pointMap[1];
	    var height = pointMap[2];
	    var x = this.getRateX(point[0], width);
	    var y = this.getRateY(point[1], height);
	    var z = this.getRateX(point[2], width);
	    var w = this.getRateY(point[3], height);
	    this.clickXYZW(x, y, z, w, deltaX, deltaY);
	  },
	  clickTextUI(TextUI, deltaX, deltaY) {
	    this.clickBounds(TextUI.bounds(), deltaX, deltaY);
	  },
	  clickTextOCR(TextOCR, deltaX, deltaY) {
	    this.clickBounds(TextOCR.bounds, deltaX, deltaY);
	  },
	};

	var TEXT_MAX_SEARCH_TIME = 10000; //搜索控件时超时时间 http://doc.autoxjs.com/#/widgetsBasedAutomation?id=uiselectorfindonetimeout
	var logUtils$3 = logUtils$4;
	var textUtils$1 = {
	  logBounds (bounds) {
	    var left = bounds.left;
	    var right = bounds.right;
	    var top = bounds.top;
	    var bottom = bounds.bottom;
	    logUtils$3.log (left, right, top, bottom);
	  },
	  inScreen (TextUI) {
	    var bounds = TextUI.bounds ();
	    var left = bounds.left;
	    var right = bounds.right;
	    var top = bounds.top;
	    var bottom = bounds.bottom;
	    return (
	      left > 0 && right < device.width && top < device.height && bottom > 0
	    );
	  },
	  existsText (text$) {
	    if (text (text$).exists ()) {
	      var TextUI = text (text$).findOne (TEXT_MAX_SEARCH_TIME);
	      return TextUI ? TextUI : false;
	    } else {
	      return false;
	    }
	  },
	  existsTextInSceen (text$) {
	    var TextUI = this.existsText (text$);
	    return TextUI ? this.inScreen (TextUI) : false;
	  },
	};

	var deviceUtils$2 = {
	  lockScreen () {
	    lockScreen ();
	  },
	  back () {
	    back ();
	  },
	  home () {
	    home ();
	  },
	  recents () {
	    recents ();
	  },
	};

	var gUtils$3 = {
	  random (min, max) {
	    return random (min, max);
	  },
	  sleep (start, end) {
	    var duration = this.random (start, end) * 1000;
	    sleep (duration);
	  },
	  sleepB (duration) {
	    sleep (duration);
	  },
	  possible (start, end, scale) {
	    var scale = scale || 100;
	    var v = this.random (1, scale);
	    return v >= start && v <= end;
	  },
	  hasExec (startTime) {
	    var now = Date.now ();
	    return parseInt ((now - startTime) / 1000);
	  },
	};

	var logUtils$2 = logUtils$4;
	var deviceUtils$1 = deviceUtils$2;
	var clickUtils$2 = clickUtils$3;
	var gUtils$2 = gUtils$3;
	var pointMap$2 = {
	  关闭所有应用: [[420, 2006, 660, 2246], 1080, 2340],
	};
	var appUtils$1 = {
	  appName: null,
	  openApp(appName) {
	    this.appName = appName;
	    var result = app.launchApp(appName);
	    logUtils$2.log("打开：", appName, result ? "成功" : "失败");
	    sleep(2 * 1000);
	    return result;
	  },
	  closeRecent() {
	    deviceUtils$1.home();
	    sleep(2 * 1000);
	    deviceUtils$1.recents();
	    sleep(2 * 1000);
	    if (["cannon", "evergo"].includes(device.product)) {
	      swipe(
	        device.width / 4 + device.width / 8 + device.width / 16,
	        device.height / 2,
	        device.width / 20,
	        device.height / 2,
	        200
	      );
	    } else {
	      swipe(
	        device.width / 2,
	        device.height / 2,
	        device.width / 2,
	        device.height / 16,
	        gUtils$2.random(300, 500)
	      );
	    }
	    sleep(2 * 1000);
	    deviceUtils$1.home();
	    sleep(2 * 1000);
	  },
	  closeAll() {
	    deviceUtils$1.home();
	    sleep(2 * 1000);
	    deviceUtils$1.recents();
	    sleep(2 * 1000);
	    clickUtils$2.clickPointMap(pointMap$2.关闭所有应用);
	    sleep(2 * 1000);
	  },
	  checkInstall(appName) {
	    return !!app.getPackageName(appName);
	  },
	  home(appName) {
	    logUtils$2.log("将回到桌面");
	    home();
	    gUtils$2.sleep(10, 15);
	    this.openApp(appName);
	  },
	};

	var ocrCharMap$1 = {
	  搜: ["嫂", "樓", "接", "楼"],
	  赚: ["廉", "嫌", "賺", "兼"],
	  看: ["着", "春"],
	  文: ["女"],
	  章: ["拿"],
	  钱: ["线"],
	  觉: ["党"],
	  户: ["戶"],
	  索: ["素"],
	  开: ["升", "研"],
	  金: ["全"],
	  积: ["枳"],
	  币: ["市"],
	  现: ["現"],
	  领: ["領", "颌", "颁"],
	  读: ["渎"],
	  额: ["額"],
	  取: ["驭"],
	  视: ["规", "初"],
	  享: ["亨"],
	  兑: ["兌"],
	  提: ["堤"],
	  体: ["休"],
	  才: ["オ"],
	  街: ["衔"],
	  城: ["械"],
	  间: ["闻"],
	  来: ["來"],
	  幕: ["慕"],
	  十: ["+"],
	  已: ["己"],
	  己: ["已"],
	  摄: ["攝"],
	};
	var ocrCharMap_1 = ocrCharMap$1;

	var logUtils$1 = logUtils$4;
	var ocrCharMap = ocrCharMap_1;

	if (!requestScreenCapture()) {
	  toastLog("请求截图权限失败");
	  exit();
	}
	function toArray(arrLike) {
	  var array = [];
	  for (var index = 0; index < arrLike.length; index++) {
	    array.push(arrLike[index]);
	  }
	  return array;
	}
	function getCaptureImg() {
	  var startTime = Date.now();
	  var showing = logUtils$1.showing;
	  if (showing) {
	    logUtils$1.hide();
	    sleep(0.1 * 1000);
	  }
	  var captureImg = captureScreen();
	  if (showing) {
	    logUtils$1.show();
	  }
	  if (!captureImg) {
	    toastLog("截图失败");
	  }
	  var endTime = Date.now();
	  var hasExec = (endTime - startTime) / 1000;
	  if (hasExec > 1) {
	    logUtils$1.log("GCI: 截图耗费-" + hasExec + "-s");
	  }
	  return captureImg;
	}
	function getOcrResults() {
	  var captureImg = getCaptureImg();
	  var ocrResults = toArray(gmlkit.ocr(captureImg, "zh").toArray(3));
	  setTimeout(() => {
	    captureImg.recycle();
	  });
	  return ocrResults;
	}
	var ocrUtils$2 = {
	  getRegExpConfig(content) {
	    var regExpStr = content
	      .split("")
	      .map(function (item) {
	        var match = ocrCharMap[item];
	        var piece = match
	          ? "[" + match.concat(item).join("") + "]+"
	          : "[" + item + "]+";
	        return piece + `\\s*`;
	      })
	      .join("");
	    return {
	      text: content,
	      regExp: new RegExp(regExpStr, "gi"),
	    };
	  },
	  captureAndLog() {
	    var ocrResults = getOcrResults();
	    this.logOcrResults(ocrResults);
	  },
	  logOcrResults(ocrResults) {
	    logUtils$1.log("LOR:", "\n", ocrResults.map((item) => item.text).join(","));
	  },
	  ocrResultsExist(ocrResults, regExpConfig) {
	    for (var index = 0; index < ocrResults.length; index++) {
	      var ocrResult = ocrResults[index];
	      if (regExpConfig.regExp.test(ocrResult.text)) {
	        return ocrResult;
	      }
	    }
	    return false;
	  },
	  regExpConfigExist(ocrResults, regExpConfigs) {
	    for (var index = 0; index < ocrResults.length; index++) {
	      var ocrResult = ocrResults[index];
	      for (var index2 = 0; index2 < regExpConfigs.length; index2++) {
	        var regExpConfig = regExpConfigs[index2];
	        if (regExpConfig.regExp.test(ocrResult.text)) {
	          return ocrResult;
	        }
	      }
	    }
	    return false;
	  },
	  regExpConfigExistSome(ocrResults, regExpConfigs) {
	    var results = [];
	    for (var index = 0; index < ocrResults.length; index++) {
	      var ocrResult = ocrResults[index];
	      for (var index2 = 0; index2 < regExpConfigs.length; index2++) {
	        var regExpConfig = regExpConfigs[index2];
	        if (regExpConfig.regExp.test(ocrResult.text)) {
	          results.push(ocrResult);
	        }
	      }
	    }
	    return results;
	  },
	  captureExistsText(content, logOcrResults, ignoreLog) {
	    var regExpConfig = this.getRegExpConfig(content);
	    var ocrResults = getOcrResults();
	    var ocrResult = this.ocrResultsExist(ocrResults, regExpConfig);
	    if (ocrResult) {
	      if (!ignoreLog) {
	        logUtils$1.log("CET:", "找到", regExpConfig.text, "/", ocrResult.text);
	      }
	      return ocrResult;
	    } else {
	      if (logOcrResults) {
	        this.logOcrResults(ocrResults);
	      }
	      return false;
	    }
	  },
	  captureExistsOneText(contents, logOcrResults, ignoreLog) {
	    if (!Array.isArray(contents)) {
	      contents = [contents];
	    }
	    var ocrResults = getOcrResults();
	    var regExpConfigs = contents.map((content) =>
	      this.getRegExpConfig(content)
	    );
	    var ocrResult = this.regExpConfigExist(ocrResults, regExpConfigs);
	    if (ocrResult) {
	      if (!ignoreLog) {
	        logUtils$1.log("CEOT:", "找到", contents.join(","), "/", ocrResult.text);
	      }
	      return ocrResult;
	    } else {
	      logUtils$1.log("CEOT:", "没找到", contents.join(","));
	      if (logOcrResults) {
	        this.logOcrResults(ocrResults);
	      }
	      return false;
	    }
	  },
	  captureExistsSomeText(contents, logOcrResults, ignoreLog) {
	    if (!Array.isArray(contents)) {
	      contents = [contents];
	    }
	    var ocrResults = getOcrResults();
	    var regExpConfigs = contents.map((content) =>
	      this.getRegExpConfig(content)
	    );
	    var results = this.regExpConfigExistSome(ocrResults, regExpConfigs);
	    if (results.length > 0) {
	      if (!ignoreLog) {
	        logUtils$1.log(
	          "CEOT:",
	          "找到",
	          contents.join(","),
	          "/",
	          results.map((item) => item.text).join(",")
	        );
	      }
	      return results;
	    } else {
	      logUtils$1.log("CEOT:", "没找到", contents.join(","));
	      if (logOcrResults) {
	        this.logOcrResults(ocrResults);
	      }
	      return false;
	    }
	  },

	  captureExistsAllText(contents, logOcrResults, ignoreLog) {
	    if (!Array.isArray(contents)) {
	      contents = [contents];
	    }
	    var ocrResults = getOcrResults();
	    var regExpConfigs = contents.map((content) =>
	      this.getRegExpConfig(content)
	    );
	    var findResults = [];
	    for (var index = 0; index < regExpConfigs.length; index++) {
	      var regExpConfig = regExpConfigs[index];
	      var ocrResult = this.ocrResultsExist(ocrResults, regExpConfig);
	      if (ocrResult) {
	        findResults.push(ocrResult);
	      }
	    }
	    if (findResults.length == contents.length) {
	      if (!ignoreLog) {
	        logUtils$1.log(
	          "CEAT:",
	          "找到",
	          "\n",
	          contents.join(","),
	          "\n",
	          findResults.map((item) => item.text).join(",")
	        );
	      }
	      return true;
	    } else {
	      logUtils$1.log("CEAT:", "没找到", contents.join(","));
	      if (logOcrResults) {
	        this.logOcrResults(ocrResults);
	      }
	      return false;
	    }
	  },
	};

	var logUtils = logUtils$4;
	var clickUtils$1 = clickUtils$3;
	var textUtils = textUtils$1;
	var deviceUtils = deviceUtils$2;
	var appUtils = appUtils$1;
	var gUtils$1 = gUtils$3;
	var ocrUtils$1 = ocrUtils$2;

	var utils = {
	  logUtils: logUtils,
	  clickUtils: clickUtils$1,
	  textUtils: textUtils,
	  deviceUtils: deviceUtils,
	  appUtils: appUtils,
	  gUtils: gUtils$1,
	  ocrUtils: ocrUtils$1,
	};

	var pointMap$1 = {
	  立即领取: {
	    关闭: [[485, 1645, 595, 1755], 1080, 2340],
	  },
	};

	var { ocrUtils, clickUtils, gUtils } = utils;
	var pointMap = pointMap$1;
	function main() {
	  var text$ = "立即领取";
	  var TextOCR = ocrUtils.captureExistsOneText([text$]);
	  while (TextOCR) {
	    clickUtils.clickTextOCR(TextOCR);
	    gUtils.sleep(3, 8);
	    clickUtils.clickPointMap(pointMap.立即领取.关闭, 10, 10);
	    gUtils.sleep(3, 8);
	    ocrUtils.captureExistsOneText([text$]);
	  }
	}
	var getIt = main;

	var getIt$1 = /*@__PURE__*/getDefaultExportFromCjs(getIt);

	return getIt$1;

})();
